<?php

/**
 * Created by PhpStorm.
 * User: xiaotao
 * Date: 18-5-13
 * Time: 下午9:42
 */
namespace app\common\behavior;

class CrossDomain
{
    public function run ($dispatch) {
        $headers = [
            "Access-Control-Allow-Origin" => '*',
            "Access-Control-Allow-Credentials" => 'true',
            "Access-Control-Allow-Headers" => "x-token,x-uid,x-token-check,x-requested-with,content-type,Host"
        ];
        if($dispatch instanceof Response) {
            $dispatch->header($headers);
        }
    }
}